package com.rsk.dao.curriculum.extend;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;


@Component
public class RskCourseEvaluateExtend {
	
	public Map<String, Object> selectskCourseEvaluateByPage(Long courseId){
		 // 拼接SQL语句
       StringBuilder sql = new StringBuilder("select id,comments,comment_time,comment_status,comment_source,");
       sql.append("comment_user,comment_photo,user_id,is_top from rsk_course_evaluate rce where is_del = 0");
       StringBuilder countSql = new StringBuilder("select count(id) from rsk_course_evaluate where is_del = 0");
       
       // 查询需要的参数，先存进Map
       StringBuilder paramSql = new StringBuilder();
       Map<String, Object> paramMap = new HashMap<String, Object>();
       if(courseId!=null){
    	   paramSql.append(" and course_id = :courseId");
    	   paramMap.put("courseId",  courseId);
       }
       //排序
       StringBuilder orderSql = new StringBuilder();
       orderSql = orderSql.append(" order by operator_time desc");
       Map<String, Object> returnMap = new HashMap<String, Object>();
       
       returnMap.put("sql", sql.append(paramSql).append(orderSql));
       returnMap.put("countSQL", countSql.append(paramSql));
       returnMap.put("paramMap", paramMap);
       return returnMap;
	}
}
 